﻿// --------------------------------------------------------------------------------------
// <copyright file="ProductService.cs" company="NGroup">
// Copyright (c) NGroup. All rights reserved.
// </copyright>
// --------------------------------------------------------------------------------------
// <history>
//     <change who="Nguyen Vu Nam" date="2013.12.19">Create</change>
// </history>
// --------------------------------------------------------------------------------------

namespace NGroup.VTL.Service
{
    using System;
    using System.Collections.Generic;
    using NGroup.VTL.Core.Const;
    using NGroup.VTL.DAL;
    using NGroup.VTL.DAL.Abstraction;
    using NGroup.VTL.Models;
    using NGroup.VTL.Service.Abstraction;

    public class RetrieveContentService : IRetrieveContentService
    {
        private IRetrieveContentDAO _retrieveContentDAO;

        public RetrieveContentService()
        {
            _retrieveContentDAO = new RetrieveContentDAO();
        }

        public NewsModel GetNewsDetail(string uniqueString, LanguageCodes lang)
        {
            return _retrieveContentDAO.GetNewsDetail(uniqueString, lang);
        }

        public List<ProductModel> GetProductListByTypeAndPagingInfo(int parentTypeID, int? childTypeID, LanguageCodes lang, ref PagingInfoModel pagingInfo)
        {
            return _retrieveContentDAO.GetProductListByTypeAndPagingInfo(parentTypeID, childTypeID, lang, ref pagingInfo);
        }

        public ProductModel GetProductDetail(int parentTypeID, int childTypeID, string uniqueString, LanguageCodes lang, out List<ProductModel> relatedProducts)
        {
            return _retrieveContentDAO.GetProductDetail(parentTypeID, childTypeID, uniqueString, lang, out relatedProducts);
        }

        public Dictionary<string, List<ProductModel>> GetHomePageProductList(LanguageCodes lang)
        {
            return _retrieveContentDAO.GetHomePageProductList(lang);
        }

        public List<NewsModel> GetNewsListByTypeAndPagingInfo(int? typeID, LanguageCodes lang, ref PagingInfoModel pagingInfo)
        {
            return _retrieveContentDAO.GetNewsListByTypeAndPagingInfo(typeID, lang, ref pagingInfo);
        }

        public bool PlaceOrder(OrderModel order)
        {
            order.OrderDate = DateTime.Now;

            return _retrieveContentDAO.PlaceOrder(order);
        }
    }
}
